var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ADManager = require("ADManager");
var $2UIManager = require("UIManager");
var $2UserDataManager = require("UserDataManager");
var $2MenuUI = require("MenuUI");
var $2FlbDataStorageUtil = require("FlbDataStorageUtil");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_ChflbUI = /* */function (_cc$Component12) {
  babel_inherits(h, _cc$Component12);
  var _super14 = babel_createSuper(h);
  function h() {
    var _this40;
    babel_classCallCheck(this, h);
    _this40 = _super14.apply(this, arguments);
    _this40.q009 = null;
    _this40.a129 = null;
    _this40.a1291 = null;
    return _this40;
  }
  babel_createClass(h, [{
    key: "onLoad",
    value: function onLoad() {
         Adv_skd.default.instance.hideAllAdv();
                        Adv_skd.default.instance.showInterstitialAd();
                        Adv_skd.default.instance.showGridAdRight();
                        Adv_skd.default.instance.showGridAdLeft();

      this.q009 = cc.find("q009", this.node);
      this.a129 = cc.find("a129", this.node);
      this.a1291 = cc.find("a1291", this.node);
      if ($2FlbDataStorageUtil.DataStorageUtil.getVal("chflb", false)) {
        this.a1291.active = true;
        this.a129.active = false;
      }
      this.q009.on(cc.Node.EventType.TOUCH_START, this.on_close, this);
      this.a129.on(cc.Node.EventType.TOUCH_END, this.on_join_group, this);
    }
  }, {
    key: "on_join_group",
    value: function on_join_group() {
      $2FlbDataStorageUtil.DataStorageUtil.getVal("chflb", false) || $2ADManager.default.instance.joinGroup(function (e) {
        if (e) {
          $2UIManager.default.instance.showToast("加入成功！！");
          $2UserDataManager.default.instance.diamond += 1e3;
          $2UserDataManager.default.instance.gold += 5e3;
          $2FlbDataStorageUtil.DataStorageUtil.setVal("chflb", true);
        } else {
          $2UIManager.default.instance.showToast("粉丝群已满，暂时无法加入！！");
        }
      });
    }
  }, {
    key: "on_close",
    value: function on_close() {
      Adv_skd.default.instance.hideAllAdv();

      $2UIManager.default.instance.closeUI("ChflbUI");
      $2UIManager.default.instance.uiList.MenuUI.getComponent($2MenuUI.default).showNode();
    }
  }]);
  return h;
}(cc.Component);
def_ChflbUI = cc__decorate([ccp_ccclass], def_ChflbUI);
exports.default = def_ChflbUI;